package com.cqsw.bbs.controller;

import com.cqsw.bbs.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author: ZackYoung
 * @time: 2020/6/5
 */
@Controller
public class TestController {
    @Autowired
    private UserMapper userMapper;
    @RequestMapping("/test")
    public ModelAndView test(ModelAndView mav){
        mav.setViewName("test_file");
        return mav;
    }
//    @RequestMapping("/index")
//    public ModelAndView indexPage(ModelAndView mav, HttpServletRequest req){
//        String commonPath = "/static/";
//        mav.addObject("commonPath",commonPath);
//        mav.setViewName("index");
//        return mav;
//    }
    @RequestMapping("test_nickname")
    @ResponseBody
    public String g(String nickname){
        System.out.println(userMapper.queryNikeName(nickname));
        return "success";
    }
}
